package com.jiot.controller.device;

import com.zg.cloud.BaseResponse;
import com.zg.cloud.annotation.TokenCheck;
import com.zg.cloud.service.HelpCenterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import req.help.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author hushi
 * @date 2020/11/17 11:45
 * @description
 */
@RestController
@RequestMapping("/device/help")
@Api(value = "帮助中心模块")
public class HelpCenterController {

    @Resource
    private HelpCenterService helpCenterService;

    @PostMapping("/add/help/center")
    @TokenCheck
    @ApiOperation(value = "添加帮助", notes = "device")
    public BaseResponse addHelpCenter(@RequestBody @Valid AddHelpCenterReq addHelpCenterReq) {
        helpCenterService.addHelpCenter(addHelpCenterReq);
        return new BaseResponse();
    }

    @PostMapping("/del/help/center")
    @TokenCheck
    @ApiOperation(value = "删除帮助", notes = "device")
    public BaseResponse delHelpCenter(@RequestBody @Valid DelHelpCenterReq delHelpCenterReq) {
        helpCenterService.delHelpCenter(delHelpCenterReq);
        return new BaseResponse();
    }

    @PostMapping("/modify/help/center")
    @TokenCheck
    @ApiOperation(value = "修改帮助", notes = "device")
    public BaseResponse modifyHelpCenter(@RequestBody @Valid ModifyHelpCenterReq modifyHelpCenterReq) {
        helpCenterService.modifyHelpCenter(modifyHelpCenterReq);
        return new BaseResponse();
    }

    @PostMapping("/detail/help/center")
    @TokenCheck
    @ApiOperation(value = "帮助详情", notes = "device")
    public BaseResponse detailHelpCenter(@RequestBody @Valid DetailHelpCenterReq detailHelpCenterReq) {
        return new BaseResponse(helpCenterService.detailHelpCenter(detailHelpCenterReq));
    }

    @PostMapping("/inquire/help/center")
    @TokenCheck
    @ApiOperation(value = "查看所有帮助", notes = "device")
    public BaseResponse inquireHelpCenter() {
        return new BaseResponse(helpCenterService.inquireHelpCenter());
    }

    @PostMapping("/help/center/asc")
    @TokenCheck
    @ApiOperation(value = "升序", notes = "device")
    public BaseResponse helpCenterAsc(@RequestBody @Valid HelpCenterAscReq helpCenterAscReq) {
        helpCenterService.helpCenterAsc(helpCenterAscReq);
        return new BaseResponse();
    }

    @PostMapping("/help/center/desc")
    @TokenCheck
    @ApiOperation(value = "降序", notes = "device")
    public BaseResponse helpCenterDesc(@RequestBody @Valid HelpCenterDescReq helpCenterDescReq) {
        helpCenterService.helpCenterDesc(helpCenterDescReq);
        return new BaseResponse();
    }

}
